﻿@{
    Layout = "_Layout.cshtml";
}
<form method="post" class="ui-validForm">
    <div class="set-box">
        <div class="pr-title"><h3>创建管理员</h3></div>
        <div class="set">
            <ul>
                <li><span>管理员用户名</span><input type="text" value="admin" id="username" name="username" maxlength="15" class="input" data-validate="dataType:'username',nullMsg:'请填写用户名!'" /> <span class="help-block"></span></li>
                <li><span>升级同名用户</span><input type="checkbox" id="updateSameUser" name="updateSameUser" value="1" checked /> <span class="help-block">勾选后如果有同名用户则在原用户基础上修改密码并设为超级管理员。</span></li>
                <li><span>管理员密码</span><input type="password" id="password" name="password" maxlength="30" class="input" data-validate="dataType:'password',nullMsg:'请填写密码!'" /> <span class="help-block"></span></li>
                <li><span>密码确认</span><input type="password" id="password1" name="password1" maxlength="30" class="input" data-validate="dataType:'password',nullMsg:'请填写确认密码!',errorMsg:'两次输入的密码不一致!',compare:'#password'" /> <span class="help-block"></span></li>
            </ul>
        </div>
    </div>
    <div class="btn-box">
        <input type="hidden" name="Guid" id="Guid" value="@Html.Guid()" />
        <input type="button" id="bt_next" class="btn btn-next" value="上一步" onclick="location.href='@Url.ActionUrl("Step3")'" />
        <input type="button" id="bt_next" class="btn btn-back ui-pagePost" value="下一步" data-custom-params="url:'@Url.ActionUrl("SetAdminer")',callBack:'CallBack',successMsg:''" />
    </div>
</form>
<script type="text/javascript">

    $(".setpbox").css("width", "800px");
    function newGuid() {
        var guid = "";
        for (var i = 1; i <= 8; i++) {
            var n = Math.floor(Math.random() * 16.0).toString(16);
            guid += n;
        }
        return guid;
    }
    function SetDesk()
    {
        $("#System_DesKey").val(newGuid());
    }
    var $username = $("#username");
    function CallBack(data)
    {
        if (typeof (data) != "object") {
            data = $.parseJSON(data)
        }
        if (data.State == 1)
        {
            location.href = "@Url.ActionUrl("over")";
        }
        else
        {
            alert(data.Msg)
            $username.focus();
        }
    }
</script>

